//CONSTRAINTS AND MILITARY COORDINATION
//HOW ICTs SHAPE THE INTENSITY OF REBEL VIOLENCE//
//Martin Macias Medellin
//Laura H. Atuesta Becerra
//January, 2021

clear
set more off

use constraints&military_coordination_databasev3.dta, clear

preserve
//civil war variable
keep if year<2008
sort cowcode
by cowcode: egen guerra_civil_estable=max(civilwar) 

sort cowcode year
xtset cowcode year

* Controls
global z fragment log_lexclpop polity2 log_pop i.reg_afr i.reg_ame i.reg_asi i.reg_eur 


//MAIN MODELS (Columns A to F from table 1)
//model 1. bivariate relationship. internet. COLUMN A
xtnbreg annual_gen_deathsunk L.us_internet L.us_internet2 if guerra_civil_estable==1 & year<2008, re nolog  
//model 2. bivariate relationship. mobile. COLUMN B
xtnbreg annual_gen_deathsunk L.mobile L.mobile2 if guerra_civil_estable==1 & year<2008, re nolog 
//model 3. both cell and internet with no additional variables. COLUMN C
xtnbreg annual_gen_deathsunk L.us_internet L.us_internet2 L.mobile L.mobile2 if guerra_civil_estable==1 & year<2008, re nolog
//modelo 4. both cell and internet with additional varibles. COLUMN D
xtnbreg annual_gen_deathsunk L.us_internet L.us_internet2 L.mobile L.mobile2 L.annual_gen_deathsunk L.civ_deaths_gov log_oildep $z if guerra_civil_estable==1 & year<2008, re nolog //solo civil war
//modelo 5. Internet interacted with 2004 dummy. COLUMN E
xtnbreg annual_gen_deathsunk L.annual_gen_deathsunk L.us_internet facebook internet_facebook L.mobile L.mobile2 L.civ_deaths_gov log_oildep $z  if guerra_civil_estable==1 & year<2008, re nolog
test L.us_internet+internet_facebook=0
//modelo 6. Dummies for decades. COLUMN F
xtnbreg annual_gen_deathsunk L.annual_gen_deathsunk internet1990 internet2000  celular1990 celular2000  L.civ_deaths_gov  log_oildep $z  if guerra_civil_estable==1 & year<2008, re nolog

//IRR (table 2)
xtnbreg annual_gen_deathsunk L.us_internet L.us_internet2 if guerra_civil_estable==1 & year<2008, re nolog irr 
xtnbreg annual_gen_deathsunk L.mobile L.mobile2 if guerra_civil_estable==1 & year<2008, re nolog irr
xtnbreg annual_gen_deathsunk L.us_internet L.us_internet2 L.mobile L.mobile2 if guerra_civil_estable==1 & year<2008, re nolog irr
xtnbreg annual_gen_deathsunk L.annual_gen_deathsunk L.us_internet L.us_internet2 L.mobile L.mobile2 L.civ_deaths_gov log_oildep $z if guerra_civil_estable==1 & year<2008, re nolog irr
xtnbreg annual_gen_deathsunk L.annual_gen_deathsunk L.us_internet facebook internet_facebook L.mobile L.mobile2 L.civ_deaths_gov log_oildep $z  if guerra_civil_estable==1 & year<2008, re nolog irr
xtnbreg annual_gen_deathsunk L.annual_gen_deathsunk internet1990 internet2000  celular1990 celular2000  L.civ_deaths_gov  log_oildep $z  if guerra_civil_estable==1 & year<2008, re nolog irr


//ONLINE APPENDIX

//Table A.1. Fixed effects estimations

//Column A. Conditional fixed effects with time-variant variables
global y fragment log_lexclpop polity2 log_pop  
xtnbreg annual_gen_deathsunk L.annual_gen_deathsunk L.us_internet L.us_internet2 L.mobile L.mobile2 L.civ_deaths_gov $y if guerra_civil_estable==1 & year<2008, fe nolog //solo civil war
//Column B. Random effects
xtnbreg annual_gen_deathsunk L.annual_gen_deathsunk L.us_internet L.us_internet2 L.mobile L.mobile2 L.civ_deaths_gov $y if guerra_civil_estable==1 & year<2008, re nolog //solo civil war




//Table A.2.

//Column A. excluding the lag of the dependent variable as covariate
xtnbreg annual_gen_deathsunk L.us_internet L.us_internet2 L.mobile L.mobile2 L.civ_deaths_gov log_oildep $z if guerra_civil_estable==1 & year<2008, re nolog //solo civil war
//Column B. including the lag of the depndent variable as covariate.
xtnbreg annual_gen_deathsunk L.annual_gen_deathsunk L.us_internet L.us_internet2 L.mobile L.mobile2 L.civ_deaths_gov log_oildep $z if guerra_civil_estable==1 & year<2008, re nolog //solo civil war
//Column C. replacing the lag of the dependent variable by a 3-year moving average of the dependent variable
sort cowcode year
gen ma_violence3=(L1.annual_gen_deathsunk + L2.annual_gen_deathsunk + L3.annual_gen_deathsunk)/3
gen ma_violence5=(L1.annual_gen_deathsunk + L2.annual_gen_deathsunk + L3.annual_gen_deathsunk + L4.annual_gen_deathsunk + L5.annual_gen_deathsunk)/5
global z fragment log_lexclpop polity2 log_pop i.reg_afr i.reg_ame i.reg_asi i.reg_eur 
xtnbreg annual_gen_deathsunk ma_violence3 L.us_internet L.us_internet2 L.mobile L.mobile2 L.civ_deaths_gov log_oildep $z if guerra_civil_estable==1 & year<2008, re nolog //solo civil war

restore

//Table A.3. all main estimations but considering the whole period (until 2015)
preserve
sort cowcode
by cowcode: egen guerra_civil_estable=max(civilwar) 

sort cowcode year
xtset cowcode year

* Controls
global z fragment log_lexclpop polity2 log_pop i.reg_afr i.reg_ame i.reg_asi i.reg_eur 

//model 1. bivariate relationship. internet. COLUMN A
xtnbreg annual_gen_deathsunk L.us_internet L.us_internet2 if guerra_civil_estable==1 , re nolog  
//model 2. bivariate relationship. mobile. COLUMN B
xtnbreg annual_gen_deathsunk L.mobile L.mobile2 if guerra_civil_estable==1, re nolog 
//model 3. both cell and internet with no additional variables. COLUMN C
xtnbreg annual_gen_deathsunk L.us_internet L.us_internet2 L.mobile L.mobile2 if guerra_civil_estable==1, re nolog
//modelo 4. both cell and internet with additional varibles. COLUMN D
xtnbreg annual_gen_deathsunk L.us_internet L.us_internet2 L.mobile L.mobile2 L.annual_gen_deathsunk L.civ_deaths_gov log_oildep $z if guerra_civil_estable==1, re nolog //solo civil war
//modelo 5. Internet interacted with 2004 dummy. COLUMN E
xtnbreg annual_gen_deathsunk L.us_internet facebook internet_facebook L.mobile L.mobile2 L.annual_gen_deathsunk L.civ_deaths_gov log_oildep $z  if guerra_civil_estable==1, re nolog
test L.us_internet+internet_facebook=0
//modelo 6. Dummies for decades. COLUMN F
xtnbreg annual_gen_deathsunk internet1990 internet2000  celular1990 celular2000 L.annual_gen_deathsunk L.civ_deaths_gov  log_oildep $z  if guerra_civil_estable==1, re nolog

restore
